#include <iostream>
#include <log4c.h>

sg_log_t* log = sg_log4c_init(NULL,SG_ALL);

namespace sg {

	class Me;

	class MyDearFriend 
	{
	public :
		void TellAge(Me& me);
	};

	class Me 
	{
	public :
		// constructor
		Me(){this->age="20";}
		// two friend function and one friend class regist
		friend void MyDearFriend::TellAge(Me& me);
		friend void TellAgeFunc(Me& me);
		friend class MyDearSister;
	private :
		const char* age;	
	};

	void MyDearFriend::TellAge(Me& me)
	{
		sg_log4c_write(log,SG_TRACE,me.age);
	}

	void TellAgeFunc(Me& me)
	{
		sg_log4c_write(log,SG_TRACE,me.age);
	}

	class MyDearSister
	{
	public :
		void TellSisterAge(Me& me)
		{
			sg_log4c_write(log,SG_TRACE,me.age);
		}
	};
}

int main()
{
	// initialize three object
	sg::Me me;
	sg::MyDearFriend my_friend;
	sg::MyDearSister sister;

	// call friend function
	my_friend.TellAge(me);
	// call friend globel function
	TellAgeFunc(me);
	// call friend class
	sister.TellSisterAge(me);

	return 0;
}

